﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using Zendesk.NET;
using Zendesk.NET.Models;

namespace TestConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            var client = new Client("1881", "frank.barkenes@1881.no/token", "O0PyICY6aax912tOzFS0c8r7UfmeXQYmHERV317i");

            //var organizations = client.GetOrganizations();
            //foreach (var o in organizations.Organizations)
            //{
            //    Console.WriteLine(o.Id + "\t" + o.Name);
            //}

            //var organizationId = Int32.Parse(Console.ReadLine());
            //var organization = client.GetOrganization(organizationId);

            //Console.WriteLine(organization.Name);

            
            //client.UpdateTicket(14947, new Comment {Description = "Tester fra sofaen, jeg tror jeg klarte det", IsPublic = false});

            var forums = client.GetForums();
            foreach (var forum in forums.Forums)
            {
                //if (forum.Category != null)
                Console.WriteLine(forum.Id + "\t" + forum.Name + "\t In category> ");
            }

            Console.WriteLine();
            Console.WriteLine("Enter forumid>");
            var forumId = Int32.Parse(Console.ReadLine());

            var entries = client.GetEntries(forumId);
            foreach (var entry in entries.Entries)
            {
                Console.WriteLine(entry.Id + "\t" + entry.Title);
            }

            Console.WriteLine();
            Console.WriteLine("Enter entryid>");
            var entryId = Int32.Parse(Console.ReadLine());

            var posts = client.GetPosts(entryId);
            foreach (var post in posts.Posts)
            {
             Console.WriteLine(post.Body);   
            }
        }
    }
}
